3.232 \(\int \tan ^2(c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx\)

Optimal. Leaf size=87 \[ \frac {(a B+A b) \tan ^2(c+d x)}{2 d}+\frac {(a A-b B) \tan (c+d x)}{d}+\frac {(a B+A b) \log (\cos (c+d x))}{d}-x (a A-b B)+\frac {b B \tan ^3(c+d x)}{3 d} \]

[Out]

-(A*a-B*b)*x+(A*b+B*a)*ln(cos(d*x+c))/d+(A*a-B*b)*tan(d*x+c)/d+1/2*(A*b+B*a)*tan(d*x+c)^2/d+1/3*b*B*tan(d*x+c)
^3/d

________________________________________________________________________________________

Rubi [A]  time = 0.12, antiderivative size = 87, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.138, Rules used = {3592, 3528, 3525, 3475} \[ \frac {(a B+A b) \tan ^2(c+d x)}{2 d}+\frac {(a A-b B) \tan (c+d x)}{d}+\frac {(a B+A b) \log (\cos (c+d x))}{d}-x (a A-b B)+\frac {b B \tan ^3(c+d x)}{3 d} \]

Antiderivative was successfully verified.

[In]

Int[Tan[c + d*x]^2*(a + b*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]

[Out]

-((a*A - b*B)*x) + ((A*b + a*B)*Log[Cos[c + d*x]])/d + ((a*A - b*B)*Tan[c + d*x])/d + ((A*b + a*B)*Tan[c + d*x
]^2)/(2*d) + (b*B*Tan[c + d*x]^3)/(3*d)

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3525

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[(b*d*Tan[e + f*x])/f, x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3528

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(d
*(a + b*Tan[e + f*x])^m)/(f*m), x] + Int[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x
], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && GtQ[m, 0]

Rule 3592

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(
e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(B*d*(a + b*Tan[e + f*x])^(m + 1))/(b*f*(m + 1)), x] + Int[(a + b*Tan[e
 + f*x])^m*Simp[A*c - B*d + (B*c + A*d)*Tan[e + f*x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, m}, x] && NeQ[b
*c - a*d, 0] &&  !LeQ[m, -1]

Rubi steps

\begin {align*} \int \tan ^2(c+d x) (a+b \tan (c+d x)) (A+B \tan (c+d x)) \, dx &=\frac {b B \tan ^3(c+d x)}{3 d}+\int \tan ^2(c+d x) (a A-b B+(A b+a B) \tan (c+d x)) \, dx\\ &=\frac {(A b+a B) \tan ^2(c+d x)}{2 d}+\frac {b B \tan ^3(c+d x)}{3 d}+\int \tan (c+d x) (-A b-a B+(a A-b B) \tan (c+d x)) \, dx\\ &=-(a A-b B) x+\frac {(a A-b B) \tan (c+d x)}{d}+\frac {(A b+a B) \tan ^2(c+d x)}{2 d}+\frac {b B \tan ^3(c+d x)}{3 d}+(-A b-a B) \int \tan (c+d x) \, dx\\ &=-(a A-b B) x+\frac {(A b+a B) \log (\cos (c+d x))}{d}+\frac {(a A-b B) \tan (c+d x)}{d}+\frac {(A b+a B) \tan ^2(c+d x)}{2 d}+\frac {b B \tan ^3(c+d x)}{3 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.60, size = 86, normalized size = 0.99 \[ \frac {(6 b B-6 a A) \tan ^{-1}(\tan (c+d x))+3 (a B+A b) \tan ^2(c+d x)+6 (a A-b B) \tan (c+d x)+6 (a B+A b) \log (\cos (c+d x))+2 b B \tan ^3(c+d x)}{6 d} \]

Antiderivative was successfully verified.

[In]

Integrate[Tan[c + d*x]^2*(a + b*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]

[Out]

((-6*a*A + 6*b*B)*ArcTan[Tan[c + d*x]] + 6*(A*b + a*B)*Log[Cos[c + d*x]] + 6*(a*A - b*B)*Tan[c + d*x] + 3*(A*b
 + a*B)*Tan[c + d*x]^2 + 2*b*B*Tan[c + d*x]^3)/(6*d)

________________________________________________________________________________________

fricas [A]  time = 0.55, size = 85, normalized size = 0.98 \[ \frac {2 \, B b \tan \left (d x + c\right )^{3} - 6 \, {\left (A a - B b\right )} d x + 3 \, {\left (B a + A b\right )} \tan \left (d x + c\right )^{2} + 3 \, {\left (B a + A b\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 6 \, {\left (A a - B b\right )} \tan \left (d x + c\right )}{6 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2*(a+b*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/6*(2*B*b*tan(d*x + c)^3 - 6*(A*a - B*b)*d*x + 3*(B*a + A*b)*tan(d*x + c)^2 + 3*(B*a + A*b)*log(1/(tan(d*x +
c)^2 + 1)) + 6*(A*a - B*b)*tan(d*x + c))/d

________________________________________________________________________________________

giac [B]  time = 1.36, size = 1017, normalized size = 11.69 \[ \text {result too large to display} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2*(a+b*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="giac")

[Out]

-1/6*(6*A*a*d*x*tan(d*x)^3*tan(c)^3 - 6*B*b*d*x*tan(d*x)^3*tan(c)^3 - 3*B*a*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan
(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1))*tan(d*x)^3*tan(c)^3
 - 3*A*b*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(
c) + 1)/(tan(c)^2 + 1))*tan(d*x)^3*tan(c)^3 - 18*A*a*d*x*tan(d*x)^2*tan(c)^2 + 18*B*b*d*x*tan(d*x)^2*tan(c)^2
- 3*B*a*tan(d*x)^3*tan(c)^3 - 3*A*b*tan(d*x)^3*tan(c)^3 + 9*B*a*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(
c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1))*tan(d*x)^2*tan(c)^2 + 9*A*b*log
(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan
(c)^2 + 1))*tan(d*x)^2*tan(c)^2 + 6*A*a*tan(d*x)^3*tan(c)^2 - 6*B*b*tan(d*x)^3*tan(c)^2 + 6*A*a*tan(d*x)^2*tan
(c)^3 - 6*B*b*tan(d*x)^2*tan(c)^3 + 18*A*a*d*x*tan(d*x)*tan(c) - 18*B*b*d*x*tan(d*x)*tan(c) - 3*B*a*tan(d*x)^3
*tan(c) - 3*A*b*tan(d*x)^3*tan(c) + 3*B*a*tan(d*x)^2*tan(c)^2 + 3*A*b*tan(d*x)^2*tan(c)^2 - 3*B*a*tan(d*x)*tan
(c)^3 - 3*A*b*tan(d*x)*tan(c)^3 + 2*B*b*tan(d*x)^3 - 9*B*a*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) +
tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1))*tan(d*x)*tan(c) - 9*A*b*log(4*(tan(d
*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1
))*tan(d*x)*tan(c) - 12*A*a*tan(d*x)^2*tan(c) + 18*B*b*tan(d*x)^2*tan(c) - 12*A*a*tan(d*x)*tan(c)^2 + 18*B*b*t
an(d*x)*tan(c)^2 + 2*B*b*tan(c)^3 - 6*A*a*d*x + 6*B*b*d*x + 3*B*a*tan(d*x)^2 + 3*A*b*tan(d*x)^2 - 3*B*a*tan(d*
x)*tan(c) - 3*A*b*tan(d*x)*tan(c) + 3*B*a*tan(c)^2 + 3*A*b*tan(c)^2 + 3*B*a*log(4*(tan(d*x)^4*tan(c)^2 - 2*tan
(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 + 1)) + 3*A*b*log(4*(tan(
d*x)^4*tan(c)^2 - 2*tan(d*x)^3*tan(c) + tan(d*x)^2*tan(c)^2 + tan(d*x)^2 - 2*tan(d*x)*tan(c) + 1)/(tan(c)^2 +
1)) + 6*A*a*tan(d*x) - 6*B*b*tan(d*x) + 6*A*a*tan(c) - 6*B*b*tan(c) + 3*B*a + 3*A*b)/(d*tan(d*x)^3*tan(c)^3 -
3*d*tan(d*x)^2*tan(c)^2 + 3*d*tan(d*x)*tan(c) - d)

________________________________________________________________________________________

maple [A]  time = 0.03, size = 135, normalized size = 1.55 \[ \frac {b B \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}+\frac {A \left (\tan ^{2}\left (d x +c \right )\right ) b}{2 d}+\frac {a B \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {a A \tan \left (d x +c \right )}{d}-\frac {b B \tan \left (d x +c \right )}{d}-\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right ) A b}{2 d}-\frac {a \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) B}{2 d}-\frac {a A \arctan \left (\tan \left (d x +c \right )\right )}{d}+\frac {B \arctan \left (\tan \left (d x +c \right )\right ) b}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(d*x+c)^2*(a+b*tan(d*x+c))*(A+B*tan(d*x+c)),x)

[Out]

1/3*b*B*tan(d*x+c)^3/d+1/2/d*A*tan(d*x+c)^2*b+1/2/d*B*tan(d*x+c)^2*a+a*A*tan(d*x+c)/d-b*B*tan(d*x+c)/d-1/2/d*l
n(1+tan(d*x+c)^2)*A*b-1/2/d*ln(1+tan(d*x+c)^2)*a*B-1/d*a*A*arctan(tan(d*x+c))+1/d*B*arctan(tan(d*x+c))*b

________________________________________________________________________________________

maxima [A]  time = 1.62, size = 86, normalized size = 0.99 \[ \frac {2 \, B b \tan \left (d x + c\right )^{3} + 3 \, {\left (B a + A b\right )} \tan \left (d x + c\right )^{2} - 6 \, {\left (A a - B b\right )} {\left (d x + c\right )} - 3 \, {\left (B a + A b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 6 \, {\left (A a - B b\right )} \tan \left (d x + c\right )}{6 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)^2*(a+b*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/6*(2*B*b*tan(d*x + c)^3 + 3*(B*a + A*b)*tan(d*x + c)^2 - 6*(A*a - B*b)*(d*x + c) - 3*(B*a + A*b)*log(tan(d*x
 + c)^2 + 1) + 6*(A*a - B*b)*tan(d*x + c))/d

________________________________________________________________________________________

mupad [B]  time = 6.20, size = 84, normalized size = 0.97 \[ \frac {\mathrm {tan}\left (c+d\,x\right )\,\left (A\,a-B\,b\right )-\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (\frac {A\,b}{2}+\frac {B\,a}{2}\right )+{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {A\,b}{2}+\frac {B\,a}{2}\right )-d\,x\,\left (A\,a-B\,b\right )+\frac {B\,b\,{\mathrm {tan}\left (c+d\,x\right )}^3}{3}}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(c + d*x)^2*(A + B*tan(c + d*x))*(a + b*tan(c + d*x)),x)

[Out]

(tan(c + d*x)*(A*a - B*b) - log(tan(c + d*x)^2 + 1)*((A*b)/2 + (B*a)/2) + tan(c + d*x)^2*((A*b)/2 + (B*a)/2) -
 d*x*(A*a - B*b) + (B*b*tan(c + d*x)^3)/3)/d

________________________________________________________________________________________

sympy [A]  time = 0.38, size = 136, normalized size = 1.56 \[ \begin {cases} - A a x + \frac {A a \tan {\left (c + d x \right )}}{d} - \frac {A b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {A b \tan ^{2}{\left (c + d x \right )}}{2 d} - \frac {B a \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {B a \tan ^{2}{\left (c + d x \right )}}{2 d} + B b x + \frac {B b \tan ^{3}{\left (c + d x \right )}}{3 d} - \frac {B b \tan {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (A + B \tan {\relax (c )}\right ) \left (a + b \tan {\relax (c )}\right ) \tan ^{2}{\relax (c )} & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)**2*(a+b*tan(d*x+c))*(A+B*tan(d*x+c)),x)

[Out]

Piecewise((-A*a*x + A*a*tan(c + d*x)/d - A*b*log(tan(c + d*x)**2 + 1)/(2*d) + A*b*tan(c + d*x)**2/(2*d) - B*a*
log(tan(c + d*x)**2 + 1)/(2*d) + B*a*tan(c + d*x)**2/(2*d) + B*b*x + B*b*tan(c + d*x)**3/(3*d) - B*b*tan(c + d
*x)/d, Ne(d, 0)), (x*(A + B*tan(c))*(a + b*tan(c))*tan(c)**2, True))

________________________________________________________________________________________